# coding=utf-8
import os
import multiprocessing
from gevent.pywsgi import WSGIServer
from mbsh import create_app


app = create_app(os.getenv('FLASK_CONFIG') or 'default')

if __name__ == '__main__':
    # 解决多线程重复绑定端口问题
    multiprocessing.freeze_support()
    from mbsh.data import main as main_blueprint
    app.register_blueprint(main_blueprint)
    # app.run()
    # run_simple(app.config['MODEL_API_HOST'], 5000, app, use_reloader=False)
    http_server = WSGIServer(('127.0.0.1', 5005), app)
    http_server.serve_forever()
